// 分页控件 created by Jay.Wu

//var pageOptions = null;
var pageOptions = {isJump:true, isPost:true};
var pageUrl;
var pageNum;
var pageUtilForm = "pageUtilForm";

function turnPage(postUrl, url, page) {
	pageUrl = url;
	pageNum = page;

	if (pageOptions) {
		//alert(pageOptions.isJump);
		if (pageOptions.func) {
			pageOptions.func();
		}
	
		if (pageOptions.isJump) {
			if (pageOptions.isPost) {
				document.getElementById(pageUtilForm).action = postUrl + page;
				document.getElementById(pageUtilForm).submit();
			} else {
				window.location = url + page;
			}
		}

		if (pageOptions.para) {
		}

	} else {
		window.location = url + page;
		//getContent(url+page,"queryResultDiv");
	}
}

//ajax翻页
	var xmlHttp = createXMLHttpRequest();
	function createXMLHttpRequest() {
		var xmlHttp = false;
		if (window.XMLHttpRequest) { // Mozilla, Safari,...
			xmlHttp = new XMLHttpRequest();
			if (xmlHttp.overrideMimeType){
				xmlHttp.overrideMimeType('text/xml');
			}
		}else if (window.ActiveXObject){ // IE
			try{
				xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
			}catch(E) {
				try{
					xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
				}catch(E){}
			}
		}
		if (!xmlHttp) {
			alert('');
			return false;
		}
		return xmlHttp;
	}
	function getContent(url,div){
		document.getElementById(div).innerHTML = "<center><img src='<%=basePath%>/images/ajax/ajax-loader.gif'><br>正在查询...</center>";
		var xmlHttp=createXMLHttpRequest();
		xmlHttp.open('POST', url, true);
		xmlHttp.send(null);
		xmlHttp.onreadystatechange =function(){
			if(xmlHttp.readyState != 4) {
				return;
			}
			if (xmlHttp.status != 200) {
				return;
			}
			document.getElementById(div).innerHTML=xmlHttp.responseText;
		}
	}
